<!--
 * @Descripttion: 
 * @Author: liuYaoYu
 * @Date: 2021-12-16 18:22:18
 * @LastEditors: liuYaoYu
 * @LastEditTime: 2021-12-17 10:41:05
-->
<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <div class="box">
      <div>
        <div class="ewm"></div>
      </div>
      <ul id="ul">
        <li>1</li>
        <li>2</li>
        <li>3</li>
        <li>4</li>
        <li>5</li>
        <li>6</li>
      </ul>
      <span>11111</span>
    </div>
    <script>
      var ewm = document.querySelector(".ewm");
      console.log(ewm.parentElement); // 亲爸爸
      console.log(ewm.parentNode); // 亲爸爸
      console.log(ewm.parentNode === ewm.parentElement);
      // 子节点
      console.log(ul.childNodes); // 包含文本节点 元素几点
      console.log(ul.children); // 获取到元素节点
      console.log(ul.firstChild);
      console.log(ul.lastChild);
      console.log(ul.firstElementChild);
      console.log(ul.lastElementChild);


      console.log(ul.nextSibling);
      console.log(ul.previousSibling);
      console.log(ul.nextElementSibling);
      console.log(ul.previousElementSibling);
    </script>
  </body>
</html>
